package com.yc.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author lzk
 * @since 2024-10-12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("paper")
public class Paper implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @NotBlank(message = "试卷标题不能为空！")
    @TableField("title")
    private String title;

    @NotNull(message = "总分不能为空！")
    @TableField("score_total")
    private Integer scoreTotal;

    @NotNull(message = "时间不能为空！")
    @TableField("time")
    private Integer time;

    @NotNull(message = "开始时间不能为空！")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+0")
    @TableField("begin")
    private Timestamp begin;

    @NotNull(message = "结束时间不能为空！")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+0")
    @TableField("end")
    private Timestamp end;

    @NotNull(message = "用户不能为空！")
    @TableField("create_uid")
    private Integer createUid;

    @TableField("create_time")
    private Timestamp createTime;

    @NotNull(message = "填空题分数不能为空！")
    @TableField("tk")
    private Integer tk;

    @NotNull(message = "单选题分数不能为空！")
    @TableField("dk")
    private Integer dk;

    @NotNull(message = "多选题分数不能为空！")
    @TableField("dxs")
    private Integer dxs;

    @NotNull(message = "判断题分数不能为空！")
    @TableField("pd")
    private Integer pd;

    @TableField("status")
    private Integer status;

    //不是数据库字段
    @TableField(exist = false)
    @NotNull(message = "请选择题目！")
    private List<PaperDetail> details;


}
